package com.youyicloud.api;

import com.youyicloud.constants.Constants;
import com.youyicloud.service.EquipmentService;
import com.youyicloud.vo.ResponseBodyEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("equipment")
public class EquipmentApi {
    @Autowired
    private EquipmentService equipmentService;

    @RequestMapping("findByImeiMac")
    public ResponseBodyEntity findByImeiMac(String imeiMac){
        ResponseBodyEntity responseBodyEntity = new ResponseBodyEntity();
        responseBodyEntity.setData(equipmentService.findByImeiMac(imeiMac));
        responseBodyEntity.setMsg("按imei/Mac码查询");
        responseBodyEntity.setState(Constants.SUCCEED);
        return responseBodyEntity;
    }

    @RequestMapping("findById")
    public ResponseBodyEntity findById(Integer equipmentId){
        ResponseBodyEntity responseBodyEntity = new ResponseBodyEntity();
        responseBodyEntity.setData(equipmentService.findMapById(equipmentId));
        responseBodyEntity.setMsg("按Id查询");
        responseBodyEntity.setState(Constants.SUCCEED);
        return responseBodyEntity;
    }

}
